<{include file="public_html/header.html"}>
<{include file="public_html/left_menu.html"}>
    <blockquote class="layui-elem-quote"><{$action}></blockquote>

    <fieldset class="layui-elem-field">
        <legend>按条件搜索</legend>
        <div class="layui-field-box">
                <form class="layui-form layui-form-pane1" method="post" action="<{$current_url}>">
                    <{assign var="pid" value=$conditions['pid']|default:"all"}>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <select name="category[cate_id]" class="abc" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
                                <option value="">课程分类</option>
                                <{foreach from=$cate item=item}>
                                    <option value="<{$item.id}>" <{if $data['cate_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
                                <{/foreach}>
                            </select>
                        </div>
                        <div class="layui-inline">
                            <select name="category[kemu]" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
                                <option value="">请选择科目</option>
                                 <{foreach from=$subject item=item}>
                                    <option value="<{$item.id}>" <{if $data['kemu']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
                                <{/foreach}>
                            </select>
                        </div>

                        <div class="layui-inline">
                            <input type="text" name="category[search]" placeholder="搜索内容" value="<{if $data['search']}><{$data['search']}><{/if}>" class="layui-input">
                        </div>

                        <div class="layui-inline">
                            <button type="submit" class="layui-btn">搜索</button>
                            <a class="layui-btn" href="/course/shipinke_publish"><i class="layui-icon"></i> 发布视频课</a>
                        </div>
                    </div>
                </form>
        </div>
    </fieldset>
            
    <form class="layui-form layui-form-pane1" method="post" action="/video/update_sorts" delete_action="/video/delete">
        <div class="mt">
            <span class="l fs16">状态：</span>
            <a href="/course/index/10/<{$data.sort}>/<{$data.asc_des}>/<{$data.search}>/<{$data.cate_id}>/<{$data.kemu}>/<{$data.limit}>" <{if $data.status==10 }>class='curr'<{/if}>>全部</a>
            <a href="/course/index/1/<{$data.sort}>/<{$data.asc_des}>/<{$data.search}>/<{$data.cate_id}>/<{$data.kemu}>/<{$data.limit}>" <{if $data.status==1 }>class="curr"<{/if}>>销售中</a>
            <a href="/course/index/0/<{$data.sort}>/<{$data.asc_des}>/<{$data.search}>/<{$data.cate_id}>/<{$data.kemu}>/<{$data.limit}>" <{if $data.status==0 }>class="curr"<{/if}>>未发布</a>
            <a href="/course/index/2/<{$data.sort}>/<{$data.asc_des}>/<{$data.search}>/<{$data.cate_id}>/<{$data.kemu}>/<{$data.limit}>" <{if $data.status==2 }>class="curr"<{/if}>>已停售</a>
            <a href="/course/index/3/<{$data.sort}>/<{$data.asc_des}>/<{$data.search}>/<{$data.cate_id}>/<{$data.kemu}>/<{$data.limit}>" <{if $data.status==3 }>class="curr"<{/if}>>已过期</a>
        </div>
        <table class="layui-table" lay-even lay-skin="row">
            <thead>
                <tr>
                    <th></th>
                    <th>标题</th>
                    <th>课时</th>
                    <th>分类</th>
                    <th>发布时间</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </thead>   
            <tbody>
            <{foreach from=$zhiboke item=item}>
                <tr>
                    <td class="not_lb tal">
                    <img src="<{$item['course_img']}>" width="60px" height="60px" />
                    </td>
                    <td class="not_lb tal">
                                    <{$item.title}>
                    </td>
                    <td><{$item.course_time}>课时</td>
                    <td class="not_lb tal"><span class="c-ff6d5e"><{$item.cate_name}></span></td>
                    <td class="not_lb tal">
                        <{$item[ 'add_time']|date_format: '%Y-%m-%d <br> %H:%M:%S'}></td>
                    <td class="not_lb tal">
                        <{if $item['status']==0}>
                        未发布
                        <{elseif $item['status']==1}>
                        发布中
                        <{/if}>

                        
                    </td>
                    <td class="not_lb tal">
                        <div class="colorBtn">
                            <p><a href="/course/edit_shipinke/<{$item.id}>">编辑</a></p>
                            <p><a href="/course/edit_subject/<{$item.id}>">安排课程</a></p>
                        </div>
                    </td>
                </tr>
            <{/foreach}>
            <{if $zhiboke|count eq 0}>
                <tr>
                    <td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="8">
                        赞无数据！
                    </td>
                </tr>
            <{/if}>
            <tr>
                <td class="center" colspan="12">
                    <!-- <input type="checkbox" lay-filter="checkbox_all" title="全选">
                    <button id="delete" class="layui-btn layui-btn-primary layui-btn-small" style="margin-top:4px;"><i class="layui-icon"></i> 批量删除</button> -->
                </td>
            </tr>
            </tbody>
        </table>
    </form>
    <div class="layui-box layui-laypage layui-laypage-default">
            <{$pagination}>
        </div>
<{include file="public_html/footer.html"}>
<script>
    $(function() {
        layui.use(['form','layedit','jquery'], function() {
            var form = layui.form();
            var layedit = layui.layedit;
            $ = layui.jquery;
            form.on('select(cate_id)', function(data){
                var ii = layer.load();
                var id = data.value;
                $("#course_id").html('<option value="">请选择科目</option>');
                form.render('select');
                $.ajax({
                    type: "POST",
                    url: "/course/get_cate_subject",
                    data: {id:id},
                    dataType: "json",
                    success: function (data) {
                        var ddl = $("#subject");
                        var html ='<option value="">请选择科目</option>';
                        $(data).each(function (key) {
                            html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
                        });
                        $("#subject").html(html);
                        form.render('select');
                        layer.close(ii);
                    }
                });
            });  
        });


    })
    
</script>